/*
package com.spsy.order.task;

import com.spsy.order.domain.Order;
import com.spsy.order.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.Date;

*/
/**
 * @author: liuzhiping
 * @date: 2025/2/9 20:27
 **//*

//@Component
public class StartupTask {

    @Autowired
    private IOrderService orderService;

    @EventListener(ApplicationReadyEvent.class)
    public void onApplicationReady() {
        System.out.println("Application started! Executing startup logic...");
        // 在这里编写启动时需要执行的代码

        System.out.println("初始化插入50条数据到数据库");
        for(int i=0;i<50;i++){
            Order orders = Order.builder()
                    .orderId(Long.valueOf("1000"+i))
                    .productId("2000"+i)
                    .orderStatus("1")
                    .paymentStatus("01")
                    .payAmount(BigDecimal.ZERO)
                    .build();
            orders.setCreateTime(new Date());
            orders.setUpdateTime(new Date());
            int insertCount = orderService.insertOrder(orders);
            System.out.println("insertCount:"+insertCount);
        }


    }
}*/
